PICTools Programmer's Reference
Detect Color

The detect color process examines an image, looking for significant amounts of saturated color data.  Thresholds may be set for saturation, object size, and object count required for a positive result, and the algorithm automatically ignores color fringing and compression artifacts around the edges of dark objects.  An additional option allows the dominant image color to be ignored, allowing monochromatic documents printed on colored paper to be considered 'not color'.  This is done in a manner similar to Virtual Bulb, with all pixels of similar hue as the dominant color being disregarded.

Since determination of what constitutes a 'color' document will vary, the algorithm uses a number of parameters to define 'color', as well as a way to ignore monochromatic backgrounds, such as colored paper.

Detect color works in the HSV colorspace (hue, saturation, volume), and the threshold for 'color' is set using a minimum saturation and a minimum brightness (or volume), each expressed as a value in the range of 0 to 255.  Pixels darker or less saturated than the minimums are disregarded.  Detection of colored paper, for example, will require a high minimum brightness and a moderate to low saturation; detection of highlighter will generally use a high saturation and brightness; and detection of colored pen inks will require a low saturation and brightness.  The IgnorePaperColor option will find the dominant hue of the image, and ignore all pixels that fall near that hue.

Once pixels not meeting the requirements for 'color' are found, they are grouped into objects, and checked for those that meet the minimum size.  These objects are weighted by size (for example, an object twice as large as the minimum will count as two objects) and compared to the sensitivity threshold to determine if the image has sufficient color data to warrant an 'is color' determination. 

In addition to determining if an image has significant color content, the detect color process can also return the locations of the colored objects on the page.  The locations are returned as a set of bounding boxes, containing the X, Y, width and height in pixels of each object.  Overlapping boxes can be combined if desired.  Bounding boxes are only returned if the image is determined to be color, and if the overall saturation of the image is less than the threshold.

The Reason field is used to provide feedback on why an image was determined 'color' or 'not color'.  One or more of the following fields will be set when the image is processed, and each can be check by logically ANDing the Reason field with the enumerated value:

The confidence is generated by combining the results of the image saturation and weighted large and small object counts.  Low confidences mean that one or more of the determining factors in the decision was close to the threshold, while a high confidence value means the values were far from the threshold.  The Reason flags are intended to provide a way to define what groups of colored pixels are significant, through the changing of the minimum saturation, brightness, and size, as well as how much significant data is required for an 'is color' determination.  The average saturation, big object count, and small object count provide information on what the algorithm found in the image.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback